package com.zhdl.hardware_contact.hardware_web.respone;

import com.zhdl.hardware_contact.hardware_config.entity.ProjectConfiguration;
import lombok.Data;



@Data
public class ProjectConfigurationResp {
    public String slaveAddress ;

    public String dbAddress ;

    public String address;

    public String field;

    public String value;

    public int valueType;

    public int length;

    public int permissions;

    public String groupType;


    public String project;


    private Integer id;


    private Integer workplaceId;

    private String workplaceName;

    public static ProjectConfigurationResp fromProjectConfiguration(ProjectConfiguration projectConfiguration, String extraValue) {
        ProjectConfigurationResp dto = new ProjectConfigurationResp();
        dto.setId(projectConfiguration.getId());
        dto.setSlaveAddress(projectConfiguration.getSlaveAddress());
        dto.setDbAddress(projectConfiguration.getDbAddress());
        dto.setAddress(projectConfiguration.getAddress());
        dto.setField(projectConfiguration.getField());
        dto.setValue(projectConfiguration.getValue());
        dto.setValueType(projectConfiguration.getValueType());
        dto.setLength(projectConfiguration.getLength());
        dto.setPermissions(projectConfiguration.getPermissions());
        dto.setGroupType(projectConfiguration.getGroupType());
        dto.setProject(projectConfiguration.getProject());
        dto.setWorkplaceId(projectConfiguration.getWorkplaceId());
        dto.setWorkplaceName(extraValue);
        return dto;
    }
}
